<template>
	<view>
		<view class="seo">
			<input class="seos" type="text" v-model="sear" placeholder="输入任务名称" />
			<image class="stb" src="../../../static/seo.png" mode="" @click="sears"></image>
		</view>
		<view v-if="you">
			<view class="sneirong" v-for="(itam,index) in sears()" @click="tiao(itam.id,itam.schedule)">
				<view class="neirong">
					<view class="nr_t">
						<view class="nr_ts f m-t3"><text>任务名称：</text><text>{{itam.name}}</text></view>
						<text class="nr_tc m-t3 wcl">起始时间：{{itam.startTime}}</text>
						<text class="nr_tc m-t1 wcl">结束时间：{{itam.endTime}}</text>
					</view>
					
					<view class="nr_jd" style="width: 150upx; float: left;text-align: left;">{{itam.schedule}}</view>
					<view class="nr_jd" @tap.stop="toReport(itam.schedule,itam.id)" style="margin-left: 10px; width: 150upx; font-weight: 400;background-color: #B31610;border-radius: 10upx;color: #FFF;text-align: center;">查看成绩</view>
					<view class="nr_jd" >{{itam.score}}分</view>
				</view>
			</view>
		</view>
		
			<view class="style11" @tap="toTermReport()">
				<view style="text-align: center;line-height: 70upx;">学期</view>
				<view style="text-align: center;line-height: 30upx;">成绩</view>
			</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				renwu: [],
				you: true,
				sear: ''
			}
		},
		created() {
			let that = this
			let params = {
				"pageNo": 1,
				"pageSize": 99999
			}
			that.pyReq(that.$http.getStuTaskedList,params,function(res){
					that.renwu = res.result
			});
		},
		computed: {
			Search() {
				if(this.sear){
					return this.renwu.filter((value) =>{
						return value.name.includes(this.sear)
					})
				}
			}
		},
		methods: {
			toTermReport(){
				//跳转到学期报告列表
				uni.navigateTo({
					url: './termList'
				})
				
			},
			toReport(schedule,id){
				if(schedule!='已完成'){
					this.toast("该任务未批阅");
					return;
				}else{
					// uni.navigateTo({
					// 	url:"./baogao?id="+id
					// })
					uni.navigateTo({
						url: './scoreResult?id=' + id
					})
				}
			},
			sears() {
				if (!this.sear) {
					return this.renwu;
				}
				return this.Search
			},
			tiao(id,schedule) {
				if(schedule == '未提交'){
					this.toast('任务已截止');
					return;
				}
				uni.navigateTo({
					url: './renwuxiangqing?id=' + id
				})
			}
		}
	}
</script>
<style>
	.style11{
		position: fixed;
		width: 120upx;
		height: 120upx;
		background-color: #B31711;
		z-index: 99;
		color: #FFF;
		font-size: 30upx;
		bottom: 40upx;
		right: 40upx;
		border-radius: 100%;
		box-shadow:2px 2px 5px #000;
	}
	.seo {
		position: relative;
		background: #B31610;
		height: 100upx;
		padding-top: 40upx;
	}

	.seos {
		width: 663upx;
		height: 60upx;
		border-radius: 10upx;
		background: #FFFFFF;
		margin: 0 auto;
		font-size: 24upx;
		padding-left: 47upx;
		box-sizing: border-box;
	}

	.stb {
		position: absolute;
		right: 74upx;
		top: 56upx;
		width: 28upx;
		height: 30upx;
	}

	.sneirong {
		margin: 0 auto;
		border: 1px solid #B31610;
		width: 659upx;
		/* height: 236upx; */
		border-radius: 15upx;
		margin-top: 30upx;
		overflow: hidden;
	}

	.neirong {
		margin: 20upx;
	}

	.nr_t {
		border-bottom: 1px solid #666666;
		padding-bottom: 20upx;
	}

	.nr_t text {
		display: block;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.nr_ts {
		font-size: 27upx;
		font-weight: 700;
		line-height: 70upx;
	}

	.nr_ts {
		font-size: 27upx;
		line-height: 70upx;
	}

	.nr_jd {
		font-size: 29upx;
		color: #B31610;
		font-weight: 700;
		margin-top: 10upx;
		margin-bottom: 10upx;
		text-align: right;
		width: 120upx;
		float: right;
	}
</style>
